<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "kd_student".
 *
 * @property integer $xs_id
 * @property string $xs_name
 * @property string $xs_xb
 * @property integer $xs_age
 * @property string $xs_height
 * @property string $xs_weight
 * @property integer $yey_id
 * @property integer $bj_id
 * @property integer $ls_id
 * @property string $update_time
 * @property string $update_people
 */
class Student extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'kd_student';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['xs_name', 'xs_xb', 'xs_age', 'xs_height', 'xs_weight', 'yey_id', 'bj_id', 'ls_id'], 'required'],
            [['xs_age', 'yey_id', 'bj_id', 'ls_id'], 'integer'],
            [['update_time','xs_xm','xs_birth','xs_dad','xs_qs','xs_qs','xs_mm'], 'safe'],
            [['xs_name', 'xs_height', 'xs_weight'], 'string', 'max' => 20],
            [['xs_xb'], 'string', 'max' => 10],
            [['update_people'], 'string', 'max' => 50],
        ];
    }

    public function behaviors(){
        return [
            [
                'class' => \app\components\behaviors\DatetimeBehavior::className(),
                'updateDate' => 'update_time',
                'createDate'=>'add_time',
            ],
            [
                'class'=>\app\components\behaviors\CreatorBehaviors::className(),
                'fieldName'=>'update_people',
            ],
            [
                'class' => \app\components\behaviors\LogBehavior::className(),
                'tableName' => '学生',
                'attributeValue' => 'xs_name',
            ],
            [
                'class'=>\app\components\behaviors\RecoverBehavior::className(),
            ],

        ];
    }

    /**
     * @inheritdoc
     */

    public function attributeLabels()
    {

        return [
            'xs_id' => '学生id',
            'xs_name' => '学生姓名',

            'xs_xm'=>'学生小名',
            'xs_birth'=>'出生日期',
            'xs_dad'=>'爸爸',
            'xs_mm'=>'妈妈',
            'xs_qs'=>'学生亲属',


            'xs_xb' => '学生性别',
            'xs_age' => '学生年龄',
            'xs_height' => '学生身高',
            'xs_weight' => '学生体重',
            'yey_id' => '幼儿园id',
            'bj_id' => '所属班级id',
            'ls_id' => '所属老师id',
            'add_time' => '添加时间',
            'update_time' => '修改时间',
            'update_people' => '修改人',
        ];
    }
}
